<?php
$this->title = "Clientes";
$this->headTitle($this->title);
?>

 <div class="pure-form pure-form-aligned">       
    <form action="<?php echo $this->url(array('action'=>'index')); ?>" method="post" id = "form">
    <input type="hidden" name="id" id = "id"/> 
    <fieldset>
        <legend>Mantenimiento Clientes</legend>
        <div class="pure-g-r">
            <div class="pure-u-1-3">  
               <div class="pure-control-group">
                    <label for="nombre" class="required">Nombre</label>    
                    <input type="text" name="nombre" value="" placeholder="Nombre" />
                </div>
            </div>
             <div class="pure-u-1-3">  
                <div class="pure-control-group">
                    <label for="cedula" class="required">C&eacute;dula </label>    
                    <input type="text" name="cedula" value=""  placeholder="C&eacute;dula" />
                </div>
            </div>  
            <div class="pure-u-1-3">            
                <div class="pure-control-group">
                    <label ></label>
                    <input class="pure-button pure-button-primary" type="submit" name="submit" id="submitbutton" value="Buscar"/>
                </div>   
            </div>                     
        </div>    

    </fieldset> 
    </form>
    <form action="<?php echo $this->url(array('action'=>'add')); ?>" method="post" id = "form"> 
    <fieldset>
        <legend>Busqueda</legend>
        <div class="alignTableMaintenance">
        <?php if(count($this->clientes) != 0 ):?>
            <table class="pure-table pure-table-bordered">
            <thead>
                <tr>
                    <th>Cedula</th>
                    <th>Nombre</th>
                    <th>Fecha Nacimiento</th>
                    <th>Tel&eacute;fono</th>
                    <th>Correo</th>
                    
                    <th style="width: 50px;">&nbsp;</th>
                </tr>
            </thead>
            <tbody>
                <?php foreach($this->clientes as $index=>$cliente) : ?>
                <tr>                   
                    <td><?php echo $this->escape($cliente['cedula']);?></td>
                    <td><?php echo $this->escape($cliente['nombre']);?></td>
                    <td><?php echo $this->escape($cliente['fecha']);?></td>
                    <td><?php echo $this->escape($cliente['telefono']);?></td>
                    <td><?php echo $this->escape($cliente['correo']);?></td>
                   
                    <td>
                        <a href="<?php echo $this->url(array('controller'=>'Client',
                            'action'=>'edit', 'id'=>$cliente['cedula']));?>"><img class="edit"/></a>
                        <a href="#" onclick="deleteAction($('#form'),'<?php echo $cliente['cedula'];?>')"><img class="delete"/></a>
                    </td>
                </tr>
                <?php endforeach; ?>
            </tbody>
            </table>
        
        <div id="dialog-confirm" title="¿Eliminar registro?" style="display:none">
            <p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>Este registro será borrado permanentemente y no podrá ser recuperado. ¿Esta seguro que desea eliminarlo?</p>
        </div>
        <?php endif ?> 
        <p> <a class="pure-button pure-button-primary" href="<?php echo $this->url(array('controller'=>'client',
                'action'=>'add'));?>">Agregar nuevo Cliente</a> </p>
     </div>
    </fieldset>
    </form>    
</div>